<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //普通函数
        const add= function(a,b){
            return a+b
        }
        //箭头函数
        const add2=(a,b) =>{
            return a+b
        }
        //单行箭头函数简写
        const add3 = (a,b) => a+b
        //箭头函数三无，
        //1、无this，会找父级this
      const obj = {
        name:'lip',
        age: 16,
        getName(){
            console.log(this.name)
        },
        getAge:() => {
            console.log(this.age)
        }
      }
      obj.getName()
      obj.getAge()

      //1、arguments
      function sum(){
            console.log(arguments)
      }
      sum(1,2,4)
      ////箭头函数不能访问伪数组
    //   const sum3 = () => {
    //     console.log(arguments) 
    //   }
    //   sum3(1,4,2)
      //可以用真数组访问
      const tota =(...args) => {
            console.log(args)
      }
      tota(1,2,3)
      

    </script>
</body>
</html>